﻿<%@ Page Language="C#" AutoEventWireup="true" CodeFile="MyTest.aspx.cs" Inherits="MyTest" %>

<!DOCTYPE html>

<html xmlns="http://www.w3.org/1999/xhtml">
<head>
    <meta name="format-detection" content="telephone=no" />
    <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
    <meta content="text/html; charset=UTF-8" http-equiv="Content-Type" />
    <meta name="viewport" content="width=device-width, initial-scale=1" />
    <meta name="apple-touch-fullscreen" content="yes" />
    <meta content="width=device-width, initial-scale=1.0,maximum-scale=1.0, user-scalable=0" name="viewport" />
    <meta content="yes" name="apple-mobile-web-app-capable" />
    <meta content="black" name="apple-mobile-web-app-status-bar-style" />
    <link href="../CSS/m.css" rel="stylesheet" />
    <link href="../CSS/MyTest.css" rel="stylesheet" />
    <script src="../Scripts/jquery-1.8.0.min.js"></script>
    <script src="http://res.wx.qq.com/open/js/jweixin-1.0.0.js"></script>
    <title>任务管理</title>
    <link href="../CSS/my-order.1.css" rel="stylesheet" />
    <script src="../Scripts/WebForms/Common.js"></script>
</head>
<body>
    <ul class="tab-list clearfix">
        <li id="btall" class="sort at" state="0">全部</li>
        <li class="sort" state="1">待执行</li>
        <li class="sort" state="2">已存档任务</li>
        <li class="sort" state="3">可撤销任务</li>
        <li class="more">
            <p class="cover"><span>更多</span></p>
            <div class="more-list" style="display: none;">
                <p state="4">无法完成</p>
            </div>
        </li>
    </ul>
    <section class="jump_patient_select" style="display: none;"></section>
    <div class="no_record none noneData" style="display: none;text-align: center;margin-top: 30%;">
        <p>还没有任何记录~</p>
    </div>

    <script type="text/javascript">
        function open(idlog, id) {
            $("#" + idlog).show();
            $("#" + id).css({ "display": "block", "bottom": "-1000px" }).animate({ bottom: "0" });
        }

        function close(idlog, id) {
            $("#" + id).animate({ bottom: "-1000px" }, 500, function () {
                $("#" + id).css("display", "none");
                $("#" + idlog).hide();
            });
        }
    </script>
    <script type="text/javascript">

        $().ready(function () {
            GetList(0);
            $(".tab-list .sort").on("click", function () {
                var that = $(this);
                $(".tab-list li").removeClass("at");
                $(".tab-list .more p span").html("更多");
                that.addClass("at");

                $(".more-list p").removeClass("at");
                $(".more-list").hide();
                //重新获取数据
                $(".jump_patient_select").html("");
                //para.PageIndex = 1;
                //para.State = that.attr("state");
                var state = that.attr("state");
                console.log(1);

                $(".loadNone").hide();
                GetList(state);

            });
        });

        //数据加载
        function GetList(num) {
            $.post("/Handler/TestHandler.ashx?action=Test", { EMPID: '<%=idNum%>' }, function (data) {
                if (data == "" || typeof (eval("(" + data + ")").List) == "undefined") {
                    $(".noneData").show();
                } else {
                    var html = "";
                    var list = eval("(" + data + ")").List;
                    if (typeof (list) != "undefined") {
                        var temp = '<section class="jump_patient_select">'
                                    + '<a href="{link}"><table class="table_data_details">'
                                        + '<tbody>'
                                        + '<tr><th width="150">姓名：</th><td>{name}</td></tr>'
                                        + '<tr><th>任务序号：</th><td>{testNo}</td></tr>'
                                        + '<tr><th>医院名称：</th><td>{hospital}</td></tr>'
                                        + '<tr><th>类型：</th><td>{type}</td></tr>'
                                        + '<tr><th>接受时间：</th><td>{receiveTime}</td></tr>'
                                        + '<tr><th>发放时间：</th><td>{sendTime}</td></tr>'
                                        + '<tr><th>计划完成时间：</th><td>{compDate}</td></tr>'
                                        + '<tr><th>实际完成时间：</th><td>{planDays}</td></tr>'
                                        + '</tbody></table></a>'
                                 + '</section>';
                        for (var i = 0; i < list.length; i++) {
                            var link = "MyTestDetial.aspx?RowNo=" + list[i].RowNo + "&HospID=" + list[i].HospID;
                            html += temp.replace(/{name}/, list[i].EMPNAME)
                                .replace(/{link}/, link)
                                .replace(/{testNo}/, list[i].RowNo)
                                .replace(/{hospital}/, list[i].HospName)
                                .replace(/{type}/, list[i].Type)
                                .replace(/{receiveTime}/, list[i].RcvDate == null || list[i].RcvDate == "" ? "无" : ChangeNewDateFormat(list[i].RcvDate))
                                .replace(/{compDate}/, list[i].CompDate == null || list[i].CompDate == "" ? "无" : ChangeNewDateFormat(list[i].CompDate))
                                .replace(/{planDays}/, list[i].PlanDays == null || list[i].PlanDays == "" ? "无" : ChangeNewDateFormat(list[i].PlanDays))
                            .replace(/{sendTime}/, list[i].SendDate == null || list[i].SendDate == "" ? "无" : ChangeNewDateFormat(list[i].SendDate));
                        }
                        $(".jump_patient_select").html(html);
                        $(".jump_patient_select").show();
                    }
                }
            });
        }

    </script>

    <script type="text/javascript">
        $(".tab-list .sort").on("click", function () {
            var that = $(this);
            $(".tab-list li").removeClass("at");
            $(".tab-list .more p span").html("更多");
            that.addClass("at");

            $(".more-list p").removeClass("at");
            $(".more-list").hide();


        })

        $(".tab-list .more").on("click", function () {
            var box = $(".more-list");
            if (box.is(":hidden")) {
                box.show();
            } else {
                box.hide();
            }
        })

        $(".more-list p").on("click", function () {
            $(".more-list p").removeClass("at");
            $(".tab-list li").removeClass("at");

            $(".tab-list .more").addClass("at");
            $(".tab-list .more p span").html($(this).html());

            $(this).addClass("at");

            //重新获取数据
            $(".jump_patient_select").html(html);
            //para.PageIndex = 1;
            //para.State = $(this).attr("state");
            isLoaded = false;
            isLoadedOnce = false;
            $(".noneData").hide();
            $(".loadNone").hide();
            GetList(1);

        })
    </script>

</body>
</html>
